package main

import (
	"bufio"
	"dahuang/services"
	"fmt"
	"os"
	"strings"
	"github.com/zw2582/zm_go_lib/helpers"
)

func main() {
	helpers.LogFileConfig()

	defaultSystemCall := services.SystemCallDefault
	defaultSystemCall.InitWords()

	reader := bufio.NewReader(os.Stdin)
	fmt.Println("旺旺！我是大黄")
	fmt.Println("---------------------")

	for {
		fmt.Print("我:")
		text, _ := reader.ReadString('\n')

		// convert CRLF to LF
		text = strings.Replace(text, "\n", "", -1)
		text = strings.Replace(text, "\r", "", -1)
		if strings.Trim(text, "") == "" {
			continue
		}

		answer := defaultSystemCall.Call(text)
		fmt.Println("大黄:", answer)
	}
}
